package Vistas;

import javax.swing.*;

import java.awt.*;

import Controlador.CCompra;

	
public class VCompra extends JFrame{
		
		    private static final long serialVersionUID = 1L;
			private JLabel lblCodCom,lblCanCom,lblTitulo;
			private JTextField txtCodCom,txtCanCom;
			private JButton btnAgrCom,btnCanCom,btnSalCom;
			private JPanel panelNorte,panelSur,p1;
			public VCompra(){
			
				setTitle("***Compras***");
				
				lblTitulo= new JLabel ("***Comprar Ingrediente***");
				lblCodCom = new JLabel ("Ingrediente:");
				txtCodCom = new JTextField(10);
				lblCanCom = new JLabel("Cantidad:    ");
				txtCanCom = new JTextField(10);
				btnAgrCom = new JButton(" Agregar ");
				btnCanCom = new JButton("Cancelar ");
			    btnSalCom = new JButton("    Salir     ");
				
				panelNorte = new JPanel(new GridLayout(4,1));
				
				p1=new JPanel(new FlowLayout(FlowLayout.CENTER));
				p1.add(lblTitulo);
				panelNorte.add(p1);
				
				p1=new JPanel(new FlowLayout(FlowLayout.LEFT));
				p1.add(lblCodCom);
				p1.add(txtCodCom);
				panelNorte.add(p1);
				
				p1=new JPanel(new FlowLayout(FlowLayout.LEFT));
				p1.add(lblCanCom);
				p1.add(txtCanCom);
				panelNorte.add(p1);
		 
		        
		        panelSur = new JPanel();
		        
		        panelSur.add(btnAgrCom);
		        panelSur.add(btnCanCom);
		        panelSur.add(btnSalCom);
		        panelNorte.add(panelSur);
		        add(panelNorte, BorderLayout.NORTH);
		        //add(panelSur, BorderLayout.SOUTH);
		        
		   	    CCompra controladorCompra = new CCompra(this);
		        
		        btnAgrCom.addActionListener(controladorCompra);
		        btnCanCom.addActionListener(controladorCompra);
		        btnSalCom.addActionListener(controladorCompra);
		        
		        setSize(400,200);
		        setVisible(true);
		        
			}
			public JTextField getTxtCodCom() {
				return txtCodCom;
			}
			public void setTxtCodCom(JTextField txtCodCom) {
				this.txtCodCom = txtCodCom;
			}
			public JTextField getTxtCanCom() {
				return txtCanCom;
			}
			public void setTxtCanCom(JTextField txtCanCom) {
				this.txtCanCom = txtCanCom;
			}
				
	}

